package org.lingshi.shopping_manager_api.config;

import cn.dev33.satoken.interceptor.SaInterceptor;
import org.lingshi.shopping_manager_api.security.CheckLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(new CheckLoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/admin/login");

        registry.addInterceptor(new SaInterceptor()).addPathPatterns("/**");
    }
}
